home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / SRunMatGen.lha / Functs.c < prev    next >
C/C++ Source or Header  |  1994-06-13  |  16KB  |  725 lines

  1. /*********************************/
  2. /* MatrixGenerator für ShadowRun */
  3. /* written by Thomas Reinhardt   */
  4. /*                               */
  5. /* Berechnungsfunktionen         */
  6. /*********************************/
  7. #include <time.h>
  8. #include <math.h>
  9. #include <string.h>
  10. #include <exec/interrupts.h>
  11. #include <exec/libraries.h>
  12. #include <exec/lists.h>
  13. #include <exec/memory.h>
  14. #include <exec/nodes.h>
  15. #include <exec/ports.h>
  16. #include <exec/types.h>
  17. #include <intuition/intuition.h>
  18. #include <libraries/dos.h>
  19. #include <libraries/dosextens.h>
  20. #include <proto/dos.h>
  21. #include <proto/exec.h>
  22. #include <proto/graphics.h>
  23. #include <proto/intuition.h>
  24. #include <proto/gadtools.h>
  25. #include <proto/diskfont.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28.  
  29. #include "MatrixGen.h"
  30. #include "all.h"
  31.  
  32. extern LONG SaveNamePointer;
  33. extern struct IntuitionBase *IntuitionBase;
  34. extern struct GfxBase *GfxBase;
  35. extern struct Library *DosBase;
  36. extern struct NewScreen MyNewScreen;
  37. extern struct Screen *MyScreen;
  38. extern struct BitMapHeader BMHD;
  39. extern struct ColorRegister Colors[16];
  40. extern struct CommodoreAmiga CAMG;
  41. extern LONG Len,xi,yi,b;
  42. extern ULONG ChunkLen;
  43. extern char *WohinDamit;
  44. extern char GfxName[255];
  45. extern char StatusName[255];
  46. extern char StandardName[255];
  47. extern char DatenFeld[255];
  48. extern BOOL success,AllDone;
  49. extern int i;
  50. extern char inread[5];
  51. extern int cBitmaps,AnzahlKnoten,AusgangsKnoten,AnzahlWichtigeDaten,Stufenwert;
  52. extern int MaxSAN;
  53. extern UBYTE xPos,yPos,MaxFarben,Language,OutputType;
  54. extern struct MatrixKomponenten Matrix[12*12];
  55. extern struct MatrixGenType MatrixDatas[1];
  56. extern BOOL CPUInSystem,Beenden,RandomDSValue;
  57. extern BOOL Zufallsstufen,KeineDatenspeicher,StatusFile,PrefsFile,BlaueKnoten;
  58. extern BOOL Schatten,SaveDatenfeld,InstallNoIC,AlwaysICInfo;
  59. extern UBYTE AnzahlCPU,AnzahlSPU,AnzahlDS,AnzahlSAN,AnzahlSN,AnzahlIOP,AnzahlBlueNodes;
  60.  
  61. void CreateSPU(ULONG x,ULONG y){
  62.     if(Beenden==FALSE){
  63.         Matrix[x+y*12].Type=2;
  64.         Matrix[x+y*12].Belegt=TRUE;
  65.         AnzahlKnotenSenken();
  66.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y-1)>=0)&&((x+0)<12)&&((y-1)<12)){
  67.             if(CreateSPUKnoten(x,y-1)) Matrix[x+y*12].N=TRUE;
  68.             }
  69.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y-1)>=0)&&((x+1)>=0)&&((y-1)<12)){
  70.             if(CreateSPUKnoten(x+1,y-1)) Matrix[x+y*12].NO=TRUE;
  71.             }
  72.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+0)>=0)&&((x+1)>=0)&&((y+0)<12)){
  73.             if(CreateSPUKnoten(x+1,y)) Matrix[x+y*12].O=TRUE;
  74.             }
  75.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+1)<12)&&((x+1)>=0)&&((y+1)>=0)){
  76.             if(CreateSPUKnoten(x+1,y+1)) Matrix[x+y*12].SO=TRUE;
  77.             }
  78.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y+1)<12)&&((x+0)<12)&&((y+1)>=0)){
  79.             if(CreateSPUKnoten(x,y+1)) Matrix[x+y*12].S=TRUE;
  80.             }
  81.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+1)<12)&&((x-1)<12)&&((y+1)>=0)){
  82.             if(CreateSPUKnoten(x-1,y+1)) Matrix[x+y*12].SW=TRUE;
  83.             }
  84.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+0)>=0)&&((x-1)<12)&&((y+0)<12)){
  85.             if(CreateSPUKnoten(x-1,y)) Matrix[x+y*12].W=TRUE;
  86.             }
  87.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y-1)>=0)&&((x-1)<12)&&((y-1)<12)){
  88.             if(CreateSPUKnoten(x-1,y-1)) Matrix[x+y*12].NW=TRUE;
  89.             }
  90.         }
  91.     }
  92.  
  93. void CreateCPU(ULONG x,ULONG y){
  94.     if(Beenden==FALSE){
  95.         Matrix[x+y*12].Type=1;
  96.         Matrix[x+y*12].Belegt=TRUE;
  97.         CPUInSystem=TRUE;
  98.         AnzahlKnotenSenken();
  99.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y-1)>=0)&&((x+0)<12)&&((y-1)<12)){
  100.             if(CreateCPUKnoten(x,y-1)) Matrix[x+y*12].N=TRUE;
  101.             }
  102.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y-1)>=0)&&((x+1)>=0)&&((y-1)<12)){
  103.             if(CreateCPUKnoten(x+1,y-1)) Matrix[x+y*12].NO=TRUE;
  104.             }
  105.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+0)>=0)&&((x+1)>=0)&&((y+0)<12)){
  106.             if(CreateCPUKnoten(x+1,y)) Matrix[x+y*12].O=TRUE;
  107.             }
  108.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+1)<12)&&((x+1)>=0)&&((y+1)>=0)){
  109.             if(CreateCPUKnoten(x+1,y+1)) Matrix[x+y*12].SO=TRUE;
  110.             }
  111.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y+1)<12)&&((x+0)<12)&&((y+1)>=0)){
  112.             if(CreateCPUKnoten(x,y+1)) Matrix[x+y*12].S=TRUE;
  113.             }
  114.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+1)<12)&&((x-1)<12)&&((y+1)>=0)){
  115.             if(CreateCPUKnoten(x-1,y+1)) Matrix[x+y*12].SW=TRUE;
  116.             }
  117.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+0)>=0)&&((x-1)<12)&&((y+0)<12)){
  118.             if(CreateCPUKnoten(x-1,y)) Matrix[x+y*12].W=TRUE;
  119.             }
  120.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y-1)>=0)&&((x-1)<12)&&((y-1)<12)){
  121.             if(CreateCPUKnoten(x-1,y-1)) Matrix[x+y*12].NW=TRUE;
  122.             }
  123.         }
  124.     }
  125.  
  126. void CreateSN(ULONG x,ULONG y){
  127.     if(Beenden==FALSE){
  128.         Matrix[x+y*12].Type=6;
  129.         Matrix[x+y*12].Belegt=TRUE;
  130.         AnzahlKnotenSenken();
  131.         }
  132.     }
  133.  
  134. void CreateSAN(ULONG x,ULONG y){
  135.     if((Beenden==FALSE)&&(MaxSAN>0)){
  136.         Matrix[x+y*12].Type=5;
  137.         MaxSAN--;
  138.         Matrix[x+y*12].Belegt=TRUE;
  139.         AnzahlKnotenSenken();
  140.         }
  141.     }
  142.  
  143. void CreateIOP(ULONG x,ULONG y){
  144.     if(Beenden==FALSE){
  145.         Matrix[x+y*12].Type=3;
  146.         Matrix[x+y*12].Belegt=TRUE;
  147.         AnzahlKnotenSenken();
  148.         }
  149.     }
  150.  
  151. void CreateDS(ULONG x,ULONG y){
  152.     if(Beenden==FALSE){
  153.         Matrix[x+y*12].Type=4;
  154.         Matrix[x+y*12].Belegt=TRUE;
  155.         AnzahlKnotenSenken();
  156.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y-1)>=0)&&((x+0)<12)&&((y-1)<12)){
  157.             if(CreateDSKnoten(x,y-1)) Matrix[x+y*12].N=TRUE;
  158.             }
  159.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y-1)>=0)&&((x+1)>=0)&&((y-1)<12)){
  160.             if(CreateDSKnoten(x+1,y-1)) Matrix[x+y*12].NO=TRUE;
  161.             }
  162.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+0)>=0)&&((x+1)>=0)&&((y+0)<12)){
  163.             if(CreateDSKnoten(x+1,y)) Matrix[x+y*12].O=TRUE;
  164.             }
  165.         if((Zufallszahl(1,6)==1)&&((x+1)<12)&&((y+1)<12)&&((x+1)>=0)&&((y+1)>=0)){
  166.             if(CreateDSKnoten(x+1,y+1)) Matrix[x+y*12].SO=TRUE;
  167.             }
  168.         if((Zufallszahl(1,6)==1)&&((x+0)>=0)&&((y+1)<12)&&((x+0)<12)&&((y+1)>=0)){
  169.             if(CreateDSKnoten(x,y+1)) Matrix[x+y*12].S=TRUE;
  170.             }
  171.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+1)<12)&&((x-1)<12)&&((y+1)>=0)){
  172.             if(CreateDSKnoten(x-1,y+1)) Matrix[x+y*12].SW=TRUE;
  173.             }
  174.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y+0)>=0)&&((x-1)<12)&&((y+0)<12)){
  175.             if(CreateDSKnoten(x-1,y)) Matrix[x+y*12].W=TRUE;
  176.             }
  177.         if((Zufallszahl(1,6)==1)&&((x-1)>=0)&&((y-1)>=0)&&((x-1)<12)&&((y-1)<12)){
  178.             if(CreateDSKnoten(x-1,y-1)) Matrix[x+y*12].NW=TRUE;
  179.             }
  180.         }
  181.     }
  182.  
  183. BOOL CreateSPUKnoten(ULONG PosX,ULONG PosY){
  184. ULONG zwsp,count;
  185. BOOL status;
  186.     status=FALSE;
  187.     if(Matrix[PosX+PosY*12].Belegt==FALSE){
  188.         zwsp=Zufallszahl(1,6);
  189.         switch(zwsp){
  190.             case 1:{
  191.                 if(AnzahlKnoten>0) status=TRUE;
  192.                 if(CPUInSystem==FALSE) CreateCPU(PosX,PosY);
  193.                 else CreateSPU(PosX,PosY);
  194.                 break;
  195.                 }
  196.             case 2:{
  197.                 if(AnzahlKnoten>0) status=TRUE;
  198.                 CreateSPU(PosX,PosY);
  199.                 break;
  200.                 }
  201.             case 3:{
  202.                 if(AnzahlKnoten>0) status=TRUE;
  203.                 CreateDS(PosX,PosY);
  204.                 break;
  205.                 }
  206.             case 4:{
  207.                 if(AnzahlKnoten>0) status=TRUE;
  208.                 CreateDS(PosX,PosY);
  209.                 break;
  210.                 }
  211.             case 5:{
  212.                 if(AnzahlKnoten>0) status=TRUE;
  213.                 count=Zufallszahl(1,3);
  214.                 if(count==1) CreateIOP(PosX,PosY);
  215.                 if(count==2) CreateSAN(PosX,PosY);
  216.                 if(count==3) CreateSN(PosX,PosY);
  217.                 break;
  218.                 }
  219.             case 6:{
  220.                 if(AnzahlKnoten>0) status=TRUE;
  221.                 count=Zufallszahl(1,3);
  222.                 if(count==1) CreateIOP(PosX,PosY);
  223.                 if(count==2) CreateSAN(PosX,PosY);
  224.                 if(count==3) CreateSN(PosX,PosY);
  225.                 break;
  226.                 }
  227.             }
  228.         }
  229.     return status;
  230.     }
  231.  
  232. BOOL CreateCPUKnoten(ULONG PosX,ULONG PosY){
  233. ULONG zwsp,count;
  234. BOOL status;
  235.     status=FALSE;
  236.     if(Matrix[PosX+PosY*12].Belegt==FALSE){
  237.         zwsp=Zufallszahl(1,6);
  238.         switch(zwsp){
  239.             case 1:{
  240.                 if(AnzahlKnoten>0) status=TRUE;
  241.                 CreateSPU(PosX,PosY);
  242.                 break;
  243.                 }
  244.             case 2:{
  245.                 if(AnzahlKnoten>0) status=TRUE;
  246.                 CreateSPU(PosX,PosY);
  247.                 break;
  248.                 }
  249.             case 3:{
  250.                 if(AnzahlKnoten>0) status=TRUE;
  251.                 CreateSPU(PosX,PosY);
  252.                 break;
  253.                 }
  254.             case 4:{
  255.                 if(AnzahlKnoten>0) status=TRUE;
  256.                 CreateDS(PosX,PosY);
  257.                 break;
  258.                 }
  259.             case 5:{
  260.                 if(AnzahlKnoten>0) status=TRUE;
  261.                 CreateDS(PosX,PosY);
  262.                 break;
  263.                 }
  264.             case 6:{
  265.                 if(AnzahlKnoten>0) status=TRUE;
  266.                 count=Zufallszahl(1,3);
  267.                 if(count==1) CreateIOP(PosX,PosY);
  268.                 if(count==2) CreateSAN(PosX,PosY);
  269.                 if(count==3) CreateSN(PosX,PosY);
  270.                 break;
  271.                 }
  272.             }
  273.         }
  274.     return status;
  275.     }
  276.  
  277. BOOL CreateDSKnoten(ULONG PosX,ULONG PosY){
  278. ULONG zwsp;
  279. BOOL status;
  280.     status=FALSE;
  281.     if(Matrix[PosX+PosY*12].Belegt==FALSE){
  282.         zwsp=Zufallszahl(1,6);
  283.         switch(zwsp){
  284.             case 1:{
  285.                 if(AnzahlKnoten>0) status=TRUE;
  286.                 if(CPUInSystem==FALSE) CreateCPU(PosX,PosY);
  287.                 else CreateSPU(PosX,PosY);
  288.                 break;
  289.                 }
  290.             case 2:{
  291.                 if(AnzahlKnoten>0) status=TRUE;
  292.                 if(CPUInSystem==FALSE) CreateCPU(PosX,PosY);
  293.                 else CreateSPU(PosX,PosY);
  294.                 break;
  295.                 }
  296.             case 3:{
  297.                 if(AnzahlKnoten>0) status=TRUE;
  298.                 CreateSPU(PosX,PosY);
  299.                 break;
  300.                 }
  301.             case 4:{
  302.                 if(AnzahlKnoten>0) status=TRUE;
  303.                 CreateSPU(PosX,PosY);
  304.                 break;
  305.                 }
  306.             case 5:{
  307.                 if(AnzahlKnoten>0) status=TRUE;
  308.                 CreateSPU(PosX,PosY);
  309.                 break;
  310.                 }
  311.             case 6:{
  312.                 if(AnzahlKnoten>0) status=TRUE;
  313.                 CreateDS(PosX,PosY);
  314.                 break;
  315.                 }
  316.             }
  317.         }
  318.     return status;
  319.     }
  320.  
  321. void AnzahlKnotenSenken(){
  322.     AnzahlKnoten-=1;
  323.     if(AnzahlKnoten<1){
  324.         Beenden=TRUE;
  325.         }
  326.     }
  327.  
  328. void CountNodes(){
  329. ULONG xx,yy;
  330.     AnzahlCPU=0;
  331.     AnzahlSPU=0;
  332.     AnzahlDS=0;
  333.     AnzahlIOP=0;
  334.     AnzahlSAN=0;
  335.     AnzahlSN=0;
  336.     for(yy=0;yy<12;yy++){
  337.         for(xx=0;xx<12;xx++){
  338.             switch(Matrix[xx+yy*12].Type){
  339.                 case 1:{AnzahlCPU++;
  340.                                 Matrix[xx+12*yy].Nummer=AnzahlCPU;
  341.                                 break;
  342.                                 }
  343.                 case 2:{AnzahlSPU++;
  344.                                 Matrix[xx+12*yy].Nummer=AnzahlSPU;
  345.                                 break;
  346.                                 }
  347.                 case 3:{AnzahlIOP++;
  348.                                 Matrix[xx+12*yy].Nummer=AnzahlIOP;
  349.                                 break;
  350.                                 }
  351.                 case 4:{AnzahlDS++;
  352.                                 Matrix[xx+12*yy].Nummer=AnzahlDS;
  353.                                 break;
  354.                                 }
  355.                 case 5:{AnzahlSAN++;
  356.                                 Matrix[xx+12*yy].Nummer=AnzahlSAN;
  357.                                 break;
  358.                                 }
  359.                 case 6:{AnzahlSN++;
  360.                                 Matrix[xx+12*yy].Nummer=AnzahlSN;
  361.                                 break;
  362.                                 }
  363.                 }
  364.             }
  365.         }
  366.     }
  367.  
  368. void CountBlueDS(){
  369. ULONG xx,yy;
  370.     AnzahlBlueNodes=0;
  371.     for(yy=0;yy<12;yy++){
  372.         for(xx=0;xx<12;xx++){
  373.             if((Matrix[xx+yy*12].Secure==2)&&(Matrix[xx+12*yy].Type==4)) AnzahlBlueNodes++;
  374.             }
  375.         }
  376.     }
  377.  
  378. ULONG Berechne1W6(){
  379. ULONG ergebnis;
  380.     ergebnis=Zufallszahl(1,6);
  381.     return ergebnis;
  382.     }
  383.  
  384. ULONG Berechne2W6(){
  385. ULONG ergebnis;
  386.     ergebnis=Zufallszahl(1,6)+Zufallszahl(1,6);
  387.     return ergebnis;
  388.     }
  389.  
  390. ULONG BerechneStufe(){
  391. ULONG ergebnis,returnwert;
  392.     ergebnis=0;
  393.     if((Zufallszahl(1,10)==1)&&(BlaueKnoten==TRUE)){
  394.         returnwert=2; /* blue */
  395.         }
  396.     else{
  397.         if(MaxFarben>=7){
  398.             ergebnis=Berechne2W6();
  399.             switch(ergebnis){
  400.                 case 6: /* gruen */
  401.                 case 8:
  402.                             returnwert=3;
  403.                             break;
  404.                 case 7: /* orange */
  405.                 case 9:
  406.                 case 10:
  407.                             returnwert=4;
  408.                             break;
  409.                 case 4: /* rot */
  410.                 case 5:
  411.                             returnwert=5;
  412.                             break;
  413.                 case 3: /* purpur */
  414.                 case 11:
  415.                             returnwert=6;
  416.                             break;
  417.                 case 2: /* schwarz */
  418.                 case 12:
  419.                             returnwert=7;
  420.                             break;
  421.                 }
  422.             }
  423.         if(MaxFarben<7){
  424.             ergebnis=Berechne1W6();
  425.             switch(ergebnis){
  426.                 case 1: /* gruen */
  427.                 case 2:
  428.                             returnwert=3;
  429.                             break;
  430.                 case 3: /* orange */
  431.                 case 4:
  432.                 case 5:
  433.                             returnwert=4;
  434.                             break;
  435.                 case 6: /* rot */
  436.                             returnwert=5;
  437.                             break;
  438.                 }
  439.             }
  440.         }
  441.     return returnwert;
  442.     }
  443.  
  444. ULONG BerechneStufenwert(){
  445. ULONG ergebnis;
  446.     ergebnis=0;
  447.     ergebnis+=Zufallszahl(1,6);
  448.     ergebnis+=Zufallszahl(1,6);
  449.     ergebnis=ergebnis/2;
  450.     return ergebnis;
  451.     }
  452.  
  453. LONG Zufallszahl(UWORD minW,UWORD maxW){
  454. LONG DBL=1;
  455.     DBL=(rand()/(RAND_MAX/(maxW+1-minW)))+minW;
  456.     return (LONG)(DBL);
  457.     }
  458.  
  459. ULONG CountMoneyDS(){
  460. ULONG ergebnis,xx,yy;
  461.     ergebnis=0;
  462.     for(yy=0;yy<12;yy++){
  463.         for(xx=0;xx<12;xx++){
  464.             if(Matrix[xx+12*yy].Type==4){
  465.                 ergebnis+=Matrix[xx+12*yy].Datenwert*Matrix[xx+12*yy].Datensize;
  466.                 }
  467.             }
  468.         }
  469.     return ergebnis;
  470.     }    
  471.  
  472. int GetStufe(ULONG Number,ULONG Type){
  473. ULONG xx,yy;
  474. int returnwert;
  475.     returnwert=0;
  476.     for(yy=0;yy<12;yy++){
  477.         for(xx=0;xx<12;xx++){
  478.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  479.                 returnwert=Matrix[xx+12*yy].Stufe;
  480.                 }
  481.             }
  482.         }
  483.     return returnwert;
  484.     }
  485.  
  486. int GetType(ULONG Number,ULONG Type){
  487. ULONG xx,yy;
  488. int returnwert;
  489.     returnwert=0;
  490.     for(yy=0;yy<12;yy++){
  491.         for(xx=0;xx<12;xx++){
  492.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  493.                 returnwert=Matrix[xx+12*yy].Secure;
  494.                 }
  495.             }
  496.         }
  497.     return returnwert;
  498.     }
  499.  
  500. int GetDatenWert(ULONG Number,ULONG Type){
  501. ULONG xx,yy;
  502. int returnwert;
  503.     returnwert=0;
  504.     for(yy=0;yy<12;yy++){
  505.         for(xx=0;xx<12;xx++){
  506.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  507.                 returnwert=Matrix[xx+12*yy].Datenwert;
  508.                 }
  509.             }
  510.         }
  511.     return returnwert;
  512.     }
  513.  
  514. int GetDatenSize(ULONG Number,ULONG Type){
  515. ULONG xx,yy;
  516. int returnwert;
  517.     returnwert=0;
  518.     for(yy=0;yy<12;yy++){
  519.         for(xx=0;xx<12;xx++){
  520.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  521.                 returnwert=Matrix[xx+12*yy].Datensize;
  522.                 }
  523.             }
  524.         }
  525.     return returnwert;
  526.     }
  527.  
  528. int GetTypeName(ULONG Number,ULONG Type){
  529. int returnwert;
  530.     returnwert=0;
  531.     switch(GetType(Number,Type)){
  532.         case 2:{
  533.             returnwert=1;
  534.             if(Language==1) returnwert=2;
  535.             break;
  536.             }
  537.         case 3:{
  538.             returnwert=3;
  539.             if(Language==1) returnwert=4;
  540.             break;
  541.             }
  542.         case 4:{
  543.             returnwert=5;
  544.             if(Language==1) returnwert=6;
  545.             break;
  546.             }
  547.         case 5:{
  548.             returnwert=7;
  549.             if(Language==1) returnwert=8;
  550.             break;
  551.             }
  552.         case 6:{
  553.             returnwert=9;
  554.             if(Language==1) returnwert=10;
  555.             break;
  556.             }
  557.         case 7:{
  558.             returnwert=11;
  559.             if(Language==1) returnwert=12;
  560.             break;
  561.             }
  562.         }
  563.     return returnwert;
  564.     }
  565.  
  566. int GetIceArt(ULONG Number,ULONG Type){
  567. ULONG xx,yy;
  568. int returnwert;
  569.     returnwert=0;
  570.     for(yy=0;yy<12;yy++){
  571.         for(xx=0;xx<12;xx++){
  572.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  573.                 returnwert=Matrix[xx+12*yy].ICArt;
  574.                 }
  575.             }
  576.         }
  577.     return returnwert;
  578.     }
  579.  
  580. int GetIceType(ULONG Number,ULONG Type){
  581. ULONG xx,yy;
  582. int returnwert;
  583.     returnwert=0;
  584.     for(yy=0;yy<12;yy++){
  585.         for(xx=0;xx<12;xx++){
  586.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  587.                 returnwert=Matrix[xx+12*yy].ICType;
  588.                 }
  589.             }
  590.         }
  591.     return returnwert;
  592.     }
  593.  
  594. int GetIceStufe(ULONG Number,ULONG Type){
  595. ULONG xx,yy;
  596. int returnwert;
  597.     returnwert=0;
  598.     for(yy=0;yy<12;yy++){
  599.         for(xx=0;xx<12;xx++){
  600.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  601.                 returnwert=Matrix[xx+12*yy].ICStufe;
  602.                 }
  603.             }
  604.         }
  605.     return returnwert;
  606.     }
  607.  
  608. int GetWDIceStufe(ULONG Number,ULONG Type){
  609. ULONG xx,yy;
  610. int returnwert;
  611.     returnwert=0;
  612.     for(yy=0;yy<12;yy++){
  613.         for(xx=0;xx<12;xx++){
  614.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  615.                 returnwert=Matrix[xx+12*yy].WDICStufe;
  616.                 }
  617.             }
  618.         }
  619.     return returnwert;
  620.     }
  621.  
  622. int GetIceName(ULONG Number,ULONG Type){
  623. int returnwert,is,it;
  624.     returnwert=0;
  625.     if(Language==1) returnwert=1;
  626.     is=GetIceArt(Number,Type);
  627.     it=GetIceType(Number,Type);
  628.     if((it==1)&&(is==1)){
  629.         returnwert=2;
  630.         if(Language==1) returnwert=3;
  631.         }
  632.     if((it==1)&&(is==2)){
  633.         returnwert=4;
  634.         if(Language==1) returnwert=5;
  635.         }
  636.     if((it==1)&&(is==3)){
  637.         returnwert=6;
  638.         if(Language==1) returnwert=7;
  639.         if(Type==4) returnwert+=2;
  640.         }
  641.     if((it==1)&&(is==4)){
  642.         returnwert=2;
  643.         if(Language==1) returnwert=3;
  644.         }
  645.     if((it==2)&&(is==1)){
  646.         returnwert=10;
  647.         if(Language==1) returnwert=11;
  648.         }
  649.     if((it==2)&&(is==2)){
  650.         returnwert=12;
  651.         if(Language==1) returnwert=13;
  652.         }
  653.     if((it==2)&&(is==3)){
  654.         returnwert=14;
  655.         if(Language==1) returnwert=15;
  656.         }
  657.     if((it==2)&&(is==4)){
  658.         returnwert=16;
  659.         if(Language==1) returnwert=17;
  660.         }
  661.     if((it==2)&&(is==5)){
  662.         returnwert=18;
  663.         if(Language==1) returnwert=19;
  664.         }
  665.     if(it==3){
  666.         returnwert=20;
  667.         if(Language==1) returnwert=21;
  668.         }
  669.     return returnwert;
  670.     }
  671.  
  672. int GetIceNameType(ULONG Number,ULONG Type){
  673. int returnwert,it;
  674.     returnwert=0;
  675.     it=GetIceType(Number,Type);
  676.     if(it==1){
  677.         returnwert=1;
  678.         if(Language==1) returnwert=2;
  679.         }
  680.     if(it==2){
  681.         returnwert=3;
  682.         if(Language==1) returnwert=4;
  683.         }
  684.     if(it==3){
  685.         returnwert=5;
  686.         if(Language==1) returnwert=6;
  687.         }
  688.     return returnwert;
  689.     }
  690.  
  691. int GetDataInfoWert(ULONG Number,ULONG Type){
  692. int returnwert,xx,yy;
  693.     returnwert=0;
  694.     for(yy=0;yy<12;yy++){
  695.         for(xx=0;xx<12;xx++){
  696.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  697.                 if(Matrix[xx+12*yy].WichtigeDaten==TRUE){
  698.                     returnwert=3;
  699.                     if(Language==1) returnwert=4;
  700.                     }
  701.                 else{
  702.                     returnwert=1;
  703.                     if(Language==1) returnwert=2;
  704.                     }
  705.                 }
  706.             }
  707.         }
  708.     return returnwert;
  709.     }
  710.  
  711. BOOL GetWD(ULONG Number,ULONG Type){
  712. ULONG xx,yy;
  713. BOOL returnwert;
  714.     returnwert=FALSE;
  715.     for(yy=0;yy<12;yy++){
  716.         for(xx=0;xx<12;xx++){
  717.             if((Matrix[xx+12*yy].Nummer==Number)&&(Matrix[xx+12*yy].Type==Type)){
  718.                 if(Matrix[xx+12*yy].WDICType>0) returnwert=TRUE;
  719.                 else returnwert=FALSE;
  720.                 }
  721.             }
  722.         }
  723.     return returnwert;
  724.     }
  725.